<html>
<head>
	<script type="text/javascript">
		var aJaxURL	= "server-side/view/identity.action.php";		//server side folder url
		var seoyURL = "server-side/seoy/seoy.action.php";			//server side folder url
		var tName	= "example";											//table name
		var fName	= "add-edit-form";										//form name
		    	
		$(document).ready(function () {        	
			LoadTable();	
						
			/* Add Button ID, Delete Button ID */			
			SetEvents("add_button", "delete_button", "check-all", tName, fName, aJaxURL);
		});
        
		function LoadTable(){
			/* Table ID, aJaxURL, Action, Colum Number, Custom Request, Hidden Colum, Menu Array */
			GetDataTable(tName, aJaxURL, "get_list", 3, "", 0, "");
		}
		
		function LoadDialog(){		
			/* Dialog Form Selector Name, Buttons Array */
			GetDialog(fName, 500, "auto", "");
			SeoY("local", seoyURL, "identity_name", "", 0) ;			
		}
				
	    // Add - Save
	    $(document).on("click", "#save-dialog", function () {
	    	param = new Object();
		    
			//Action
	    	param.act			= "save_identity";
	    	
			//Main
	    	param.id			= $("#identity_id").val();
	    	param.rs_id			= $("#rs").val();
	    	param.local_name	= $("#local").val();
	    	
		    $.ajax({
		        url: aJaxURL,
			    data: param,
		        success: function(data) {			        
					if(typeof(data.error) != "undefined"){
						if(data.error != ""){
							alert(data.error);
						}else{
							LoadTable();
			        		CloseDialog(fName);
						}
					}
			    }
		    });
		});
		
		//--SeoY
	    $(document).on("click", ".combobox", function (event) {
	    	var i = $(this).text();
			$("#" + i).autocomplete( "search", "" );
		});
    </script>
</head>

<body>
    <div id="dt_example" class="ex_highlight_row">
        <div id="container">
            <div id="dynamic">
            	<h2 align="center">იდენტიფიკაცია</h2>
                <table class="display" id="example">
                    <thead>
                        <tr id="datatable_header">
                            <th>ID</th>
                            <th style="width: 50%">დასახელება(ზედნადები)</th>
                        	<th style="width: 50%">დასახელება(ლოკალური)</th>
                        </tr>
                    </thead>
                    <thead>
                        <tr class="search_header">
                            <th class="colum_hidden">
                            	<input type="text" name="search_id" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" name="search_rs" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" name="search_local" value="ფილტრი" class="search_init" />
                            </th>
                        </tr>
                    </thead>
                </table>
            </div>
            <div class="spacer">
            </div>
        </div>
    </div>
    
    <!-- jQuery Dialog -->
    <div id="add-edit-form" class="form-dialog" title="პროდუქტის კატეგორიები">
    	<!-- aJax -->
	</div>
</body>
</html>